package com.zxy.ziems.server.board.constant;

import java.util.Arrays;
import java.util.List;

public class BoardConstant {

    /**
     * 百分比常量类
     */
    public static final String PRODUCTION_PERCENTAGE = "production-percentage";
    /**
     * 设备属性组名称
     */
    public static final String DEVICE_EXTEND_GROUP_NAME = "设备属性";

    public enum DeviceTypeCodeEnum {
        ELECTRICITY("Ammeter","智能电表"), // 电量
        WATER("Water", "水表"), // 水量
        GAS("Gas", "燃气表"), // 燃气量
        ENVIRONMENT("Environment", "环境检测仪"), // 环境检测仪
        ;

        private String typeCode;

        private String typeName;

        private DeviceTypeCodeEnum(String typeCode, String typeName) {
            this.typeCode = typeCode;
            this.typeName = typeName;
        }

        public String getTypeCode() {
            return typeCode;
        }

        public String getTypeName() {
            return typeName;
        }

        public static List<String> getEnergyDeviceTypeCode() {
            return Arrays.asList(ELECTRICITY.typeCode, WATER.typeCode, GAS.typeCode);
        }
    }

    public enum DictItemEntiretyBoard {
        WATER("water", "水"),
        ELECTRICITY("electricity", "电"),
        GAS("gas", "天燃气");

        private final String code;
        private final String value;

        private DictItemEntiretyBoard(final String code, final String value) {
            this.code = code;
            this.value = value;
        }

        public static DictItemEntiretyBoard getByName(String value) {
            for (DictItemEntiretyBoard dictItemEntiretyBoard : values()) {
                if (dictItemEntiretyBoard.value.equals(value)) {
                    return dictItemEntiretyBoard;
                }
            }
            return null;
        }

        public String code() {
            return this.code;
        }

        public String value() {
            return this.value;
        }
    }

    /**
     * 设备属性
     */

    public enum DeviceExtendDataCodeEnum {
        COLOR("color","颜色"),
        PRODUCT_NAME("product_name", "产品名称"),
        OPERATIONAL_STATUS("operationalStatus", "状态"),
        PRODUCTION_PERCENTAGE("production-percentage", "产量百分比"),
        ;

        private String typeCode;

        private String typeName;

        private DeviceExtendDataCodeEnum(String typeCode, String typeName) {
            this.typeCode = typeCode;
            this.typeName = typeName;
        }

        public String getTypeCode() {
            return typeCode;
        }

        public String getTypeName() {
            return typeName;
        }

    }
}
